package com.cncytech.uiautomator_demo.testcase;

import com.cncytech.uiautomator_demo.BaseTest;
import com.cncytech.uiautomator_demo.TestConstant;
import com.cncytech.uiautomator_demo.RetryWatcher;
import com.cncytech.uiautomator_demo.utils.Describe;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import android.util.Log;

import org.junit.Rule;
import org.junit.Test;

/**
 * 移动数据网络测试
 */
public class DataConnectivityTest extends BaseTest {
    private static final String TAG = "DataConnectivityTest";
    @Rule
    public RetryWatcher retryWatcher = new RetryWatcher(TestConstant.retryCount);

    @Test
    @Describe(TestConstant.DATA_CONNECT_FORBIDDEN)
    public void DataConnectOffTest() {
        String msg = "移动数据关闭失败";
        int status = 0;
        assertThat(msg, hmm.setDataConnectivityPolicies(status));

        int DataConnect = hmm.getDataConnectivityPolicies();
        Log.i(TAG, "DataConnectOffTest: " + DataConnect);
        //状态一致
        assertThat(msg, DataConnect, is(status));
    }

    @Test
    @Describe(TestConstant.DATA_CONNECT_ENABLE)
    public void DataConnectOnTest() {
        String msg = "移动数据开启失败";
        int status = 1;
        assertThat(msg, hmm.setDataConnectivityPolicies(status));

        int DataConnect = hmm.getDataConnectivityPolicies();
        Log.i(TAG, "DataConnectOffTest: " + DataConnect);
        //状态一致
        assertThat(msg, DataConnect, is(status));
    }
}
